import { service as request, BasePath } from '../request'

/**
 *  查询所有路线
 */
export const getAllRoutes = () => request({
  url: `${BasePath}/route/all`,
  method: 'GET'
})

/**
 * 新增车路关联
 * @param {*} data 车路关联信息
 */
export const addVehicleRouteMap = (data) => request({
  url: `${BasePath}/vehicleRouteMap`,
  method: 'post',
  data
})
/**
 * 删除车路关联信息
 * @param {String} ids 车路关联信息id集合  多个id之间用','分割
 */
export const deleteVehicleRouteMap = (ids) => request({
  url: `${BasePath}/vehicleRouteMap/${ids}`,
  method: 'delete'
})
/**
 * 编辑路线信
 * @param {object} data 编辑后的车路关联信息
 */
export const editVehicleRouteMap = (data) => request({
  url: `${BasePath}/vehicleRouteMap`,
  method: 'put',
  data
})

/** 查询未关联车辆信息 */
export const retriveUnMapVehicles = () => request({
  url: `${BasePath}/vehicleRouteMap/retriveUnMapVehicles`,
  method: 'get'
})

/** 车辆上线 */
export const vehicleOnline = (id) => request({
  url: `${BasePath}/vehicleRouteMap/online`,
  method: 'get',
  params: { id }
})

/** 车辆下线 */
export const vehicleOffline = (id) => request({
  url: `${BasePath}/vehicleRouteMap/offline`,
  method: 'get',
  params: { id }
})
